package movies
{
	import org.osflash.signals.Signal;
	
	public class AllocineChecker
	{
		protected var remaining:Array;
		protected var running:Boolean;
		protected var allocine:Allocine;
		public function AllocineChecker(movieAdded:Signal)
		{
			running = false;
			allocine = new Allocine();
			remaining = new Array();
			movieAdded.add(onMovie);
		}
		protected function onMovie(movie:Movie):void
		{
		 	remaining.push(movie.name);
		 	if(!running)
		 	{
		 		start();
		 	}
		}
		protected function start():void
		{
			running = true;
			allocine.searchMovie(remaining[0]).addOnce(onResponse);
		}
		protected function onResponse(movie:String):void
		{
			
		}

	}
}